const { Sequelize } = require("sequelize");

const sequelize = new Sequelize("test", "root", "123456", {
  host: "localhost",
  dialect: "mysql",
  port: 3306,
  logging: false,
});

async function testConnection() {
  try {
    await sequelize.authenticate();
    console.log("数据库连接成功!");
  } catch (err) {
    console.err("无法连接数据库: ", err);
  }
}

module.exports = { sequelize, testConnection };
